package densetsu.controller.inputhandling;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

import densetsu.model.Direction;
import densetsu.model.Model;

/**
 * Will handle keyboard input (for moving the player and shooting and such).
 * 
 * @author Koen
 * 
 */
public class KeyboardHandler extends KeyAdapter {

	private Model model;

	public KeyboardHandler ( Model model ) {
		this.model = model;
	}

	@Override
	public void keyPressed ( KeyEvent e ) {
		if ( e.getKeyCode ( ) == KeyEvent.VK_LEFT ) {
			model.movePlayer ( Direction.Left );
		} else if ( e.getKeyCode ( ) == KeyEvent.VK_RIGHT ) {
			model.movePlayer ( Direction.Right );
		} else if ( e.getKeyCode ( ) == KeyEvent.VK_UP ) {
			model.movePlayer ( Direction.Up );
		} else if ( e.getKeyCode ( ) == KeyEvent.VK_DOWN ) {
			model.movePlayer ( Direction.Down );
		}
	}
}
